#ifndef TBRDYNLINKLIBMANAGER_H
#define TBRDYNLINKLIBMANAGER_H

#include "TBRdataTypeDefine.h"
#include <string>
#include <map>


namespace TBR
{

//dyn link lib base class
	class TBRdynLinkLib
	{
	public:
		TBRdynLinkLib(const char*);
		~TBRdynLinkLib();

		//loading and unload is platform dependent code
		//so handle it in the this class, so the manager class will
		//be platform independent		
		virtual void load();
		virtual void unload();
		virtual void* getSymbol(const std::string& );

		const std::string & getName() const;


	private:
		//FIXME, remove this for crossplatform support
		HINSTANCE hdll;

		std::string dynLinkName;
	};


	//window dyn link class
	class TBRdynLinkLibWin : TBRdynLinkLib
	{
		virtual void load();
		virtual void unload();

	};






// define a interface
	class TBRdynLinkLibManager
	{
	public:
		TBRdynLinkLibManager();
		~TBRdynLinkLibManager();

		TBRdynLinkLib* dynLinkLoad(char *);
		void dynLinkUnLoad(TBRdynLinkLib* );


	private:
		std::map<const std::string, TBRdynLinkLib*> dynLinkLibList;

		friend TBRdynLinkLib;
	
	};




}

#endif